package com.tabjin.rfidsocket.common.utils;

import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @author Tabjin
 * create at 2021/2/2 09:41
 * @program rfid_socket
 * @description 分页助手
 */

public class PageUtil {
    /**
     * 封装分页助手
     *
     * @param list
     * @param page
     * @return
     */
    public static PagedGridResult setPagesGrid(List<?> list, Integer page) {
        PageInfo pageList = new PageInfo<>(list);
        PagedGridResult grid = new PagedGridResult();
        grid.setPage(page);
        grid.setRows(list);
        grid.setTotal(pageList.getPages());
        grid.setRecords(pageList.getTotal());
        return grid;
    }
}
